/// 处理好友申请请求模型
class HandleFriendRequestRequest {
  final int requestId;
  final String action; // "accept", "reject", "ignore"
  final int timestamp;

  HandleFriendRequestRequest({
    required this.requestId,
    required this.action,
    int? timestamp,
  }) : timestamp = timestamp ?? DateTime.now().millisecondsSinceEpoch ~/ 1000;

  Map<String, dynamic> toJson() {
    return {
      'request_id': requestId,
      'action': action,
      'timestamp': timestamp,
    };
  }
}

/// 处理好友申请响应模型
class HandleFriendRequestResponse {
  final String status;
  final String message;
  final int? friendshipId;

  HandleFriendRequestResponse({
    required this.status,
    required this.message,
    this.friendshipId,
  });

  bool get isSuccess => status == 'success';

  factory HandleFriendRequestResponse.fromJson(Map<String, dynamic> json) {
    return HandleFriendRequestResponse(
      status: json['status'] ?? 'error',
      message: json['message'] ?? '未知错误',
      friendshipId: json['friendship_id'],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'status': status,
      'message': message,
      if (friendshipId != null) 'friendship_id': friendshipId,
    };
  }
}
